<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\section{system --- Access operating system}
\label{fn:system}
\index{system()}
\index{access operating system}
\index{shelling out}
\index{operating system access}
\begin{rail}
System : 'system' '(' String ')' ;
\end{rail}

The \verb+system+ function allows \RLaB\ programs to access the
operating system. The string argument is passed directly to the
default command interpreter for execution - normally the Bourne shell
or some variation. \RLaB\ waits until the system call is finished, and
then returns you to the prompt.  

The return value for this function is heavily system specific.  Portable
scripts should not use the return value from \verb+system+.

\paragraph{Example}
\index{example of system()}
\index{system()!example}
\begin{verbatim}
&gt; system("df")
Filesystem         1024-blocks  Used Available Capacity Mounted on
/dev/hdb5             250559  178079    59953     75%   /
/dev/hda1             207240  194580    12660     94%   /dosC
        0
&gt; system("du -s");
2953    .
&gt; system("bash");
bash$ echo "Now we have a shell running inside RLaB"
Now we have a shell running inside RLaB
bash$ w
  5:32am  up  8:09,  2 users,  load average: 0.03, 0.11, 0.09
User     tty      from             login@  idle   JCPU   PCPU  what
bradh    tty1                      9:24pm  8:08   1:05         (startx)
bradh    ttyp1                     9:53pm           22         w
bash$ exit
exit
&gt; system("ls -l Makefile");
-rw-r--r--   1 bradh    bin          3537 Mar  6 00:33 Makefile
\end{verbatim}

See also: Page~\pageref{fn:cd} \verb+cd()+,
Page~\pageref{fn:getline} \verb+getline()+.

\newpage


</pre></body></html>